<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../../common/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<sfa:mainTitle></sfa:mainTitle>
		<%@ include file="../../../common/meta.jsp"%>
		
		<link rel="stylesheet" href="${path }/script/treetable/stylesheets/master.css" type="text/css"></link>
		<script type="text/javascript" src="${path }/script/treetable/javascripts/jquery.ui.js"></script>
		<link rel="stylesheet" href="${path }/script/treetable/stylesheets/jquery.treeTable.css" type="text/css"></link>
		<script type="text/javascript" src="${path }/script/treetable/javascripts/jquery.treeTable.js"></script>
<link rel="stylesheet" href="${path }/css/jquery.autocomplete.css"
			type="text/css"></link>
		<script type="text/javascript"
			src="${path }/script/jquery.autocomplete.js">
</script>
		
		<script type="text/javascript">
jQuery(document).ready(
		function() {
			jQuery("#dnd-example").treeTable( {
			//initialState: "expanded"
					});

			jQuery("#dnd-example .folder").each(
					function() {
						jQuery(jQuery(this).parents("tr")[0]).droppable(
								{
									accept : ".file, .folder",
									drop : function(e, ui) {
										jQuery(
												jQuery(ui.draggable).parents(
														"tr")[0])
												.appendBranchTo(this);

										// Issue a POST call to send the new location (this) of the 
										// node (ui.draggable) to the server.
										jQuery.post("move.php", {
											id : jQuery(ui.draggable).parents(
													"tr")[0].id,
											to : this.id
										});
									},
									hoverClass : "accept",
									over : function(e, ui) {
										if (this.id != jQuery(ui.draggable
												.parents("tr.parent")[0]).id
												&& !jQuery(this)
														.is(".expanded")) {
											jQuery(this).expand();
										}
									}
								});
					});

			// Make visible that a row is clicked
			jQuery("table#dnd-example tbody tr").mousedown(function() {
				jQuery("tr.selected").removeClass("selected"); // Deselect currently selected rows
					jQuery(this).addClass("selected");
				});

			// Make sure row is selected when span is clicked
			jQuery("table#dnd-example tbody tr span").mousedown(function() {
				jQuery(jQuery(this).parents("tr")[0]).trigger("mousedown");
			});
		});
		function doQuery(){
		document.form1.action = "${path}/team/team/index/showtreelist";
		document.form1.submit();
	}	
		

$(document).ready(function() {
// 姓名
		var requestUrl = "${path}/team/team/index/getTeamList";
		$.ajax( {
			type : "post",//默认为get   
			dataType : "json",
			url : requestUrl,
			success : function(providerList) {
				$("#agentname").autocomplete(providerList, {
					minChars : 0,
					max : 200,
					width : 100,
					matchContains : false,
					autoFill : true,
					formatItem : function(row, i, max) {
						return row.agentname;
					},
					formatMatch : function(row, i, max) {
						return row.agentname;
					},
					formatResult : function(row) {
						return row.agentname;
					}
				});
			}
		});
	});
</script> 		
	</head>
	<body id="master">
		<sfa:mainHeader></sfa:mainHeader>
		<form action="" name="form1" method="post">
			<div class="webpart3 contentarea">
				<div class="webpart-head">
					<div class="webpart-head-item">
						育成构架树状图
					</div>
				</div>
				<div class="webpart-main">
					<div class="webpart-main-item" style="padding-top: 12px;">
						<div class="search">
							<table width="100%" border="0" cellspacing="0" cellpadding="10"
								class="table_form"> 
							<tbody>
								<tr>
									<td align="right">
										姓名：
									</td>
									<td>
										<input type="text" class="input-txt" id="agentname" name="agentname" value="${agentname}" />
									</td>
									<td align="right">
										职级：
									</td>
									<td>
										<sfa:dic showType="select" kindNo="AGENTLEVELCODE" def="ALL:全部"
											attr="class='input-txt'" name="agentLevelCode" id="agentLevelCode" code="${agentLevelCode}">
										</sfa:dic>
									</td>
									<td align="right">
										<input name="Input" type="button" class="linkbtn2" value="查  询"
											onclick="doQuery()" /> 
									</td>
							</tbody>
						</table>
					</div>
							<table id="dnd-example" class="treetable dg_borderstyle trStyleTable" width="100%" border="0"
								cellspacing="0" cellpadding="10">
								<caption></caption>
						<thead>
							<tr>
								<th>
									姓名
								</th>
								<th>
									职级
								</th>
								<th>
									FYB
								</th>
								<th>
									价保
								</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${pagination}" var="list">							
								<tr id="node-${list.agentid}"  <c:if test="${list.rowindex!=1}">class="child-of-node-${list.manageragentid}"</c:if> >
									<td>
										<span class="emp"> <a
											href="${path}/team/train/index/agentinfo?dotype=train&id=${list.agentid}">
												${list.agentname}</a> </span>
									</td>
									<td>
										${list.agentlevel}
									</td>
									<td>
										<span class="emp"><a
											href="${path}/team/train/index/policycount?aid=${list.agentid}">
												${list.fyb}</a> </span>
									</td>
									<td>
										${list.valueprem}
									</td>
								</tr>
							</c:forEach>
						</tbody> 
							</table>
					</div>
				</div>				
				<div class="webpart-foot">
					<div class="webpart-foot-item">
					</div>
				</div>
			</div>
		</form>
		<sfa:mainFooter></sfa:mainFooter>
	</body>
</html>
